package com.tianpengtech.common.validator.rules.string;

import com.tianpengtech.common.exception.ValidateException;
import com.tianpengtech.common.validator.AbstractRule;

/**
 * Created by tianpengtech on 16/8/20.
 */
public class StringMustBeEqual extends AbstractRule {


    private String v2;

    public StringMustBeEqual(String v1, String v2, String msg) {

        this.value = v1;
        this.v2 = v2;
        this.msg = msg;
    }

    @Override
    public boolean validate() throws ValidateException {
        if (!(this.value.equals(this.v2))) {
            throw new ValidateException(this.msg);
        }
        return true;
    }
}
